package controllers;

import java.util.ArrayList;
import java.util.List;

import models.User;
import models.Vehicle;
import common.FBSecure;

import play.data.validation.Required;
import play.mvc.Controller;
import play.mvc.With;

@With(FBSecure.class)
public class Vehicles extends FBController{
	
	public static void vehicles(@Required String plate, @Required String trademark, @Required String model, @Required String color, @Required String age){
		
		setFbIdandName();

		User user = getUser();
		
		if (validation.hasErrors()) {
			renderTemplate("Vehicles/vehicles.html", user);
		}
		
		user.addVehicle(user, plate, trademark, model, color, age);
		
		String msg = "Aracınız oluşturuldu!";
		
		renderTemplate("StartJourneyInfo/startjourneyinfo.html", user, msg);		
	}

}
